package com.flot.yazb.widget.update;

import android.app.Dialog;
import android.content.Context;

import com.flot.yazb.R;
import com.flot.yazb.base.BDialog;

/**
 * Created by zhh on 2017/4/10.
 */

public class AppUpdateProgressDialog extends BDialog {

    private NumberProgressBar numberProgressBar;

    public AppUpdateProgressDialog(Context context) {
        super(context, R.style.Custom_Progress);
        initLayout();
    }

    public AppUpdateProgressDialog(Context context, int theme) {
        super(context, R.style.Custom_Progress);
        initLayout();
    }

    @Override
    public boolean isCancelable(boolean b) {
        return false;
    }

    @Override
    public int setGravity(int gravity) {
        return 0;
    }

    @Override
    public int setPadWidth(float width) {
        return 260;
    }

    @Override
    public int setPadHeight(float height) {
        return 0;
    }

    private void initLayout() {
        this.setContentView(R.layout.update_progress_layout);
        getWindow().setBackgroundDrawableResource(android.R.color.transparent);
        numberProgressBar = (NumberProgressBar) findViewById(R.id.number_progress);
        this.setCanceledOnTouchOutside(false);//点击dialog背景部分不消失
//        this.setCancelable(false);//dialog出现时，点击back键不消失
    }

    public void setProgress(int mProgress) {
        numberProgressBar.setProgress(mProgress);
    }
}
